/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package gmovil_jpa.entidades;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author castlerock
 */
@Entity
@Table(name = "tipo_atributo")
@NamedQueries({
    @NamedQuery(name = "TipoAtributo.findAll", query = "SELECT t FROM TipoAtributo t"),
    @NamedQuery(name = "TipoAtributo.findByIdTipoAtributo", query = "SELECT t FROM TipoAtributo t WHERE t.idTipoAtributo = :idTipoAtributo"),
    @NamedQuery(name = "TipoAtributo.findByTipoAtributo", query = "SELECT t FROM TipoAtributo t WHERE t.tipoAtributo = :tipoAtributo")})
public class TipoAtributo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_tipo_atributo")
    private Integer idTipoAtributo;
    @Basic(optional = false)
    @Column(name = "tipo_atributo")
    private String tipoAtributo;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tipoAtributo")
    private List<Atributo> atributoList;

    public TipoAtributo() {
    }

    public TipoAtributo(Integer idTipoAtributo) {
        this.idTipoAtributo = idTipoAtributo;
    }

    public TipoAtributo(Integer idTipoAtributo, String tipoAtributo) {
        this.idTipoAtributo = idTipoAtributo;
        this.tipoAtributo = tipoAtributo;
    }

    public Integer getIdTipoAtributo() {
        return idTipoAtributo;
    }

    public void setIdTipoAtributo(Integer idTipoAtributo) {
        this.idTipoAtributo = idTipoAtributo;
    }

    public String getTipoAtributo() {
        return tipoAtributo;
    }

    public void setTipoAtributo(String tipoAtributo) {
        this.tipoAtributo = tipoAtributo;
    }

    public List<Atributo> getAtributoList() {
        return atributoList;
    }

    public void setAtributoList(List<Atributo> atributoList) {
        this.atributoList = atributoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idTipoAtributo != null ? idTipoAtributo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TipoAtributo)) {
            return false;
        }
        TipoAtributo other = (TipoAtributo) object;
        if ((this.idTipoAtributo == null && other.idTipoAtributo != null) || (this.idTipoAtributo != null && !this.idTipoAtributo.equals(other.idTipoAtributo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "gmovil_jpa.entidades.TipoAtributo[idTipoAtributo=" + idTipoAtributo + "]";
    }

}
